import React from 'react';
import { useParams } from 'react-router-dom';

import StockTags from './stock/StockTags.tsx';
import HotspotRelations from './stock/HotspotRelations.tsx';
import CapitalRelations from './stock/CapitalRelations.tsx';
import IndustrySegmentation from './stock/IndustrySegmentation.tsx';
import LeadingStockResearch from './stock/LeadingStockResearch.tsx';
import KaipanlaThemes from './stock/KaipanlaThemes.tsx';
import TonghuashunThemes from './stock/TonghuashunThemes.tsx';


const StockFinder = () => {
  const { subpage } = useParams();
  
  // 如果没有二级页面参数，使用默认值
  const currentSubpage = subpage || 'stock-tags';
  
  const getPageTitle = () => {
    switch(currentSubpage) {
      case 'stock-tags': return '个股标签';
      case 'hotspot-relations': return '热点关联';
      case 'capital-relations': return '股东关联';
      case 'industry-segmentation': return '行业细分';
      case 'leading-stock-research': return '头牌研究';
      case 'kaipanla-themes': return '开盘啦题材';
      case 'tonghuashun-themes': return '同花顺题材';
      default: return '个股挖掘';
    }
  };
  
  const getPageContent = () => {
    switch(currentSubpage) {
      case 'stock-tags': return <StockTags />;
      case 'hotspot-relations': return <HotspotRelations />;
      case 'capital-relations': return <CapitalRelations />;
      case 'industry-segmentation': return <IndustrySegmentation />;
      case 'leading-stock-research': return <LeadingStockResearch />;
      case 'kaipanla-themes': return <KaipanlaThemes />;
      case 'tonghuashun-themes': return <TonghuashunThemes />;
      default: return <p>请从左侧选择功能</p>;
    }
  };

  return (
    <div className="page-container">
      <h2>{getPageTitle()}</h2>
      {getPageContent()}
    </div>
  );
};

export default StockFinder;